package com.fxsh.learn.java;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestLambda {
    public static void test(){

        MathOperation mathOperation1 = (int a ,int b)-> a+b;

        MathOperation mathOperation2 = (a,b) -> a - b;

        MathOperation mathOperation3 = (a,b) -> {return a * b;};

        log.info("5+10 = " + operate(5,10,mathOperation1));
        log.info("5-10 = " + operate(5,10,mathOperation2));
        log.info("5*10 = " + operate(5,10,mathOperation3));
    }

    interface MathOperation {
        int operation(int a, int b);
    }

    interface GreetingService {
        void sayMessage(String message);
    }

    private static int operate(int a, int b, MathOperation mathOperation){
        return mathOperation.operation(a, b);
    }
}
